import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class palancaAzul here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class palancaAzul extends palanca
{
    /**
     * Act - do whatever the palancaAzul wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
 //   escalera es= new escalera(2);
    
    int reg;
    escalera es;
    /**
     * Constructor de palancaAzul 
     * @param recibe el tipo de palancaAzul
     */
    public palancaAzul(int dato)
    {
        reg=dato;
         es= new escalera(reg); 
    }
    
    
    public void act() 
    {
        // Add your action code here.   
        bajaEscalera();
    }
   
    /**
     * se encarga de crear la escalera en diferente posicion
     */
    public void  bajaEscalera()
    {
     Actor Azul= getOneIntersectingObject(sonicAzul.class);
     Mundo w=(Mundo) super.getWorld();
     
     if(Azul!=null)
     {
         if(reg==3)
         w.addObject(es,395,125);
         else
         if(reg==2)
         w.addObject(es,20,90);
         else
         if(reg==4)
         w.addObject(es,670,150);
     }
      else
        w.removeObject(es);
    } 
}
